package com.PVZ.engine.factory;

import com.PVZ.engine.map.GameMap;
import com.PVZ.engine.map.MapBlock;
import com.PVZ.model.Entity;
import com.PVZ.model.bullet.Sun;
import com.PVZ.model.emuns.MoveType;
import com.PVZ.model.interfaces.Gettable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Created by @Author: kabuda on @Date: 2021/5/30 13:14
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class GettableFactory {
    //可拾取对象列表
    private List<Entity> allGettableList = new ArrayList<>();

    public void generateFallingObj() {
        Random random = new Random();

        //掉落行
        int row = random.nextInt(2);
        //掉落列
        int col = random.nextInt(9);
        MapBlock block = GameMap.getBlockByCoor(row, col);

        Point point = block.getPoint();

        allGettableList.add(new Sun(point, MoveType.Down));
    }
}
